package cn.itsource.pethome.domain;

import cn.itsource.pethome.base.BaseTreeNode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.*;

@Data
@AllArgsConstructor
@ToString
public class Department extends BaseTreeNode<Department> {
    private Long id;
    private String sn;
    private String name;
    private Integer state;
    private Long managerId;
    private Long parentId;
    private String dirPath;
    private String managerName;
    private String parentName;
    //这里存放的就是当前部门的下级部门集合
    private List<Department> children = new ArrayList<>();

    public Department(){
        // arraylist 初始长度是10 ,每次扩容1.5倍,旧的长度会右位移一位 ,查询快因为有索引下标,删除或者插入慢,容易导致数组的重新复制
        ArrayList<Object> objects = new ArrayList<>();
        //LinkedList 双向链表结构,查询比较慢,但是删除比较快,然后查询头尾节点效率比较高
        LinkedList<Object> objects1 = new LinkedList<>();
        //set
        HashSet<Object> objects2 = new HashSet<>();
        TreeSet<Object> objects3 = new TreeSet<>();
        //map  初始长度是16.阈值是 数组长度*负载因子(0.75)
        // 链表长度大于8并且数组长度大于64才会转红黑树,否则继续扩容数组长度
        HashMap<Object, Object> objectObjectHashMap = new HashMap<>();

    }
    public Department(long l, String name) {
        this.id = l;
        this.name = name;
    }


    public static void main(String[] args) {
        Department department = new Department();
        department.setName("源码时代");
        Department yanfabu = new Department();
        yanfabu.setName("研发部");
        Department xuegongbu = new Department();
        xuegongbu.setName("学工部");
        department.setChildren(Arrays.asList(yanfabu,xuegongbu));
        System.out.println(department.hashCode());
    }

}
